<template>
  <p class="myHeadBtn">
    {{ data.lwmc }}
    <a-popconfirm title="确定要删除吗？" @confirm="handleClick">
      <a-button size="small" style="margin-left: 20px; vertical-align: top">{{ deleteTitle }} </a-button>
    </a-popconfirm>
    <span class="myHeadBtnTip" v-if="type === 'lwpz' && !data.id">（选择指标数据类型后自动保存）</span>
  </p>
</template>

<script>
export default {
  name: 'TitleTemplate',
  props: {
    data: Object,
    deleteHeadList: Function,
    type: String,
    deleteTitle: {
      type: String,
      default: '删除',
      required: false,
    },
  },
  mounted() {
    console.log('this:', this)
  },
  methods: {
    // 删除栏位配置
    handleClick() {
      this.deleteHeadList(this.data, this.type)
    },
  },
}
</script>
<style lang="less" scoped>
.myHeadBtn {
  line-height: 24px;
  .myHeadBtnTip {
    margin-left: 15px;
    color: #1890ff;
    font-size: 14px;
  }
}
</style>